
/** Git 命令树数据, 覆盖主命令与常见子命令与参数 */
const GIT_TREE = [ // Git 命令数组, 每个元素是一个命令节点
  {
    name: "init", // 命令名
    category: "repo", // 所属分类
    description: "初始化新仓库, 可指定初始分支与模板", // 简要描述
    options: [ // 选项列表, 包含短参与长参形式
      ["-b", "--initial-branch <name>", "指定初始分支名，避免使用默认的master分支"],
      [null, "--bare", "创建裸仓库，没有工作目录，通常用作远程仓库"],
      [null, "--template <dir>", "使用指定目录作为模板，复制其中的文件和钩子"],
      ["-q", "--quiet", "静默模式，只输出错误和警告信息"],
      [null, "--separate-git-dir <dir>", "将.git目录创建在指定位置，工作目录包含指向它的链接"],
      [null, "--object-format <format>", "指定对象格式，可选sha1或sha256"],
      [null, "--shared[=<permissions>]", "设置仓库为多用户共享，可指定权限模式"],
    ],
    examples: [ // 常见示例
      "git init -b main", // 指定初始分支为 main
      "git init --bare repo.git", // 创建裸仓库
      "git init --template=/path/to/template", // 使用模板初始化
      "git init --separate-git-dir=/path/to/git-dir", // 分离.git目录
    ],
  },
  {
    name: "clone",
    category: "repo",
    description: "从远程仓库克隆到本地, 支持浅克隆与子模块",
    options: [
      ["-b", "--branch <name>", "克隆指定分支或标签，而不是默认分支"],
      [null, "--depth <n>", "创建浅克隆，限制历史记录深度，节省带宽和存储空间"],
      [null, "--shallow-since <date>", "创建浅克隆，包含指定日期之后的提交"],
      [null, "--shallow-exclude <revision>", "创建浅克隆，排除指定修订版本可达的提交"],
      [null, "--filter <spec>", "使用部分克隆过滤器，如blob:none跳过blob对象"],
      [null, "--recurse-submodules[=<pathspec>]", "递归克隆并初始化所有子模块"],
      [null, "--shallow-submodules", "克隆的子模块也使用浅克隆"],
      [null, "--single-branch", "仅克隆单个分支，减少数据传输"],
      [null, "--no-single-branch", "克隆所有分支（默认行为）"],
      [null, "--bare", "创建裸仓库，没有工作目录"],
      [null, "--mirror", "创建镜像仓库，包含所有引用和配置"],
      ["-o", "--origin <name>", "指定远程仓库名称，默认为origin"],
      ["-c", "--config <key=value>", "设置克隆仓库的配置选项"],
      [null, "--template <dir>", "使用指定模板目录"],
      [null, "--reference <repo>", "从本地仓库借用对象以节省网络传输"],
      [null, "--dissociate", "借用对象后断开与参考仓库的连接"],
      ["-j", "--jobs <n>", "并行获取子模块的数量"],
      ["-q", "--quiet", "静默模式，减少输出信息"],
      ["-v", "--verbose", "详细模式，显示更多进度信息"],
      [null, "--progress", "强制显示进度信息"],
      [null, "--server-option <option>", "传递选项给服务器"],
    ],
    examples: [
      "git clone --depth 1 -b main <url>",
      "git clone --recurse-submodules <url>",
      "git clone --filter=blob:none <url>",
      "git clone --reference /path/to/local/repo <url>",
      "git clone -c http.sslVerify=false <url>",
    ],
  },
  {
    name: "config",
    category: "repo",
    description: "查看与修改配置, 支持系统级, 全局与本地作用域",
    options: [
      [null, "--system", "操作系统级配置文件(/etc/gitconfig)"],
      [null, "--global", "用户级配置文件(~/.gitconfig)"],
      [null, "--local", "仓库级配置文件(.git/config)，默认选项"],
      [null, "--worktree", "工作树级配置文件(.git/config.worktree)"],
      ["-l", "--list", "列出所有配置项及其值"],
      [null, "--show-origin", "显示配置项的来源文件"],
      [null, "--show-scope", "显示配置项的作用域"],
      [null, "--get <name>", "获取指定配置项的值"],
      [null, "--get-all <name>", "获取多值配置项的所有值"],
      [null, "--get-regexp <pattern>", "获取匹配正则表达式的配置项"],
      [null, "--get-urlmatch <name> <url>", "获取URL匹配的配置值"],
      [null, "--replace-all <name> <value>", "替换配置项的所有值"],
      [null, "--add <name> <value>", "添加新的配置项（允许重复键）"],
      [null, "--unset <name>", "删除配置项"],
      [null, "--unset-all <name>", "删除配置项的所有值"],
      [null, "--rename-section <old> <new>", "重命名配置段"],
      [null, "--remove-section <name>", "删除整个配置段"],
      ["-e", "--edit", "在编辑器中打开配置文件"],
      [null, "--get-color <name>", "获取颜色配置的ANSI转义序列"],
      [null, "--get-colorbool <name>", "获取颜色布尔配置"],
      ["-t", "--type <type>", "指定值的类型(bool|int|bool-or-int|path|expiry-date|color)"],
      [null, "--bool", "将值作为布尔值处理"],
      [null, "--int", "将值作为整数处理"],
      [null, "--bool-or-int", "将值作为布尔值或整数处理"],
      [null, "--path", "将值作为路径处理，展开~和相对路径"],
      [null, "--expiry-date", "将值作为过期日期处理"],
      ["-z", "--null", "使用NUL字符分隔输出"],
      [null, "--name-only", "仅显示配置项名称"],
      [null, "--includes", "处理include指令（默认）"],
      [null, "--no-includes", "忽略include指令"],
      [null, "--default <value>", "当配置项不存在时使用的默认值"],
    ],
    examples: [
      "git config --global user.name \"Alice\"",
      "git config --global user.email \"a@example.com\"",
      "git config --list --show-origin",
      "git config --get-regexp 'remote\\..*\\.url'",
      "git config --global core.editor vim",
      "git config --global init.defaultBranch main",
      "git config --local --bool core.bare true",
    ],
  },
  {
    name: "remote",
    category: "remote",
    description: "管理远程仓库, 查看地址与清理无效分支",
    subcommands: [
      { name: "add [-t <branch>] [-m <master>] [-f] <name> <url>", description: "添加远程仓库，可指定跟踪分支和镜像分支" },
      { name: "remove <name>", description: "移除远程仓库及其所有跟踪分支" },
      { name: "rename <old> <new>", description: "重命名远程仓库，同时更新跟踪分支" },
      { name: "set-url [--push] <name> <newurl> [<oldurl>]", description: "修改远程仓库的URL地址" },
      { name: "set-url --add [--push] <name> <newurl>", description: "为远程仓库添加额外的URL" },
      { name: "set-url --delete [--push] <name> <url>", description: "删除远程仓库的指定URL" },
      { name: "get-url [--push] [--all] <name>", description: "获取远程仓库的URL地址" },
      { name: "show [-n] <name>", description: "显示远程仓库的详细信息" },
      { name: "prune [-n | --dry-run] <name>", description: "清理失效的远程跟踪分支引用" },
      { name: "update [<group> | <remote>]...", description: "更新远程仓库组或指定远程仓库" },
    ],
    options: [
      ["-v", "--verbose", "显示远程仓库的fetch和push URL地址"],
    ],
    examples: [
      "git remote -v",
      "git remote add origin <url>",
      "git remote add -t main -f origin <url>",
      "git remote set-url origin <newurl>",
      "git remote set-url --add origin <additional-url>",
      "git remote show origin",
      "git remote prune origin",
    ],
  },
  {
    name: "branch",
    category: "branch",
    description: "创建, 删除, 重命名分支, 查看本地与远程追踪状态",
    options: [
      ["-a", "--all", "显示所有分支（本地和远程跟踪分支）"],
      ["-r", "--remotes", "仅显示远程跟踪分支"],
      ["-l", "--list", "列出分支（默认行为）"],
      ["-v", "--verbose", "显示分支的最后一次提交"],
      ["-vv", null, "显示分支的上游跟踪信息和最后提交"],
      [null, "--abbrev=<length>", "设置提交哈希的显示长度"],
      [null, "--no-abbrev", "显示完整的提交哈希"],
      ["-q", "--quiet", "静默模式，减少输出"],
      [null, "--track", "创建分支时设置上游跟踪"],
      [null, "--no-track", "创建分支时不设置上游跟踪"],
      [null, "--set-upstream", "已废弃，使用--set-upstream-to"],
      [null, "--set-upstream-to=<upstream>", "设置当前分支的上游分支"],
      [null, "--unset-upstream", "取消当前分支的上游设置"],
      ["-m", "--move", "重命名分支"],
      ["-M", null, "强制重命名分支，即使目标分支已存在"],
      ["-c", "--copy", "复制分支"],
      ["-C", null, "强制复制分支，即使目标分支已存在"],
      ["-d", "--delete", "删除已完全合并的分支"],
      ["-D", null, "强制删除分支，无论是否已合并"],
      [null, "--create-reflog", "创建分支时同时创建reflog"],
      ["-f", "--force", "强制创建、移动或删除分支"],
      [null, "--merged [<commit>]", "仅显示已合并到指定提交的分支"],
      [null, "--no-merged [<commit>]", "仅显示未合并到指定提交的分支"],
      [null, "--contains [<commit>]", "仅显示包含指定提交的分支"],
      [null, "--no-contains [<commit>]", "仅显示不包含指定提交的分支"],
      [null, "--points-at <object>", "仅显示指向指定对象的分支"],
      [null, "--format <format>", "使用自定义格式显示分支信息"],
      [null, "--sort=<key>", "按指定键排序分支列表"],
      [null, "--color[=<when>]", "控制颜色输出"],
      [null, "--no-color", "禁用颜色输出"],
      [null, "--column[=<options>]", "以列格式显示分支"],
      [null, "--no-column", "不使用列格式显示"],
    ],
    examples: [
      "git branch -a",
      "git branch -r",
      "git branch -vv",
      "git branch -m old-name new-name",
      "git branch --set-upstream-to=origin/main",
      "git branch --merged main",
      "git branch --no-merged",
      "git branch -d feature-branch",
      "git branch -D force-delete-branch",
    ],
  },
  {
    name: "switch",
    category: "branch",
    description: "新式切换分支与创建分支命令, 替代部分 checkout",
    options: [
      ["-c", null, "创建并切换新分支"],
      [null, "--detach", "进入分离 HEAD 状态"],
      ["-t", "--track", "设置跟踪远程分支"],
    ],
    examples: [
      "git switch -c feature/x",
      "git switch -t origin/dev",
    ],
  },
  {
    name: "checkout",
    category: "branch",
    description: "旧式切换分支与检出文件, 文件恢复已由 restore 接管",
    options: [
      ["-b", null, "创建并切换新分支"],
      ["-B", null, "重置并切换到分支"],
    ],
    examples: [
      "git checkout -b hotfix/x",
    ],
  },
  {
    name: "status",
    category: "commit",
    description: "显示工作区和索引的状态, 查看文件变更情况",
    options: [
      ["-s", "--short", "以简短格式显示状态"],
      ["-b", "--branch", "显示分支信息"],
      [null, "--show-stash", "显示当前存储的条目数量"],
      [null, "--porcelain[=<version>]", "以机器可读格式输出，适合脚本处理"],
      [null, "--long", "以长格式显示状态（默认）"],
      ["-v", "--verbose", "显示将要提交的文件差异"],
      ["-vv", null, "显示工作区和索引的差异"],
      ["-u", "--untracked-files[=<mode>]", "显示未跟踪文件（no|normal|all）"],
      [null, "--ignored[=<mode>]", "显示被忽略的文件（traditional|matching|no）"],
      ["-z", "--null", "使用NUL字符分隔文件名"],
      [null, "--column[=<options>]", "以列格式显示未跟踪文件"],
      [null, "--no-column", "不使用列格式"],
      [null, "--ahead-behind", "显示与上游分支的领先/落后提交数"],
      [null, "--no-ahead-behind", "不计算与上游的差异"],
      [null, "--renames", "检测重命名（默认）"],
      [null, "--no-renames", "不检测重命名"],
      [null, "--find-renames[=<n>]", "检测重命名，可指定相似度阈值"],
    ],
    examples: [
      "git status",
      "git status -s",
      "git status -b --porcelain",
      "git status -u all",
      "git status --ignored",
      "git status -v",
    ],
  },
  {
    name: "add",
    category: "commit",
    description: "把变化加入索引, 支持按补丁选择与仅已跟踪文件",
    options: [
      ["-A", "--all", "添加工作树中所有变化的文件（新增、修改、删除）"],
      ["-u", "--update", "仅添加已被Git跟踪的文件的变化，忽略新文件"],
      [".", null, "添加当前目录及子目录中的所有变化"],
      ["-p", "--patch", "交互式地选择文件的部分变化进行添加"],
      ["-e", "--edit", "在编辑器中手动编辑要添加的补丁"],
      ["-f", "--force", "强制添加被.gitignore忽略的文件"],
      ["-i", "--interactive", "交互式添加模式，提供菜单选择"],
      ["-n", "--dry-run", "预演模式，显示将要添加的文件但不实际添加"],
      ["-v", "--verbose", "详细模式，显示添加的文件信息"],
      [null, "--ignore-errors", "忽略添加过程中的错误，继续处理其他文件"],
      [null, "--ignore-missing", "忽略命令行中不存在的文件"],
      [null, "--no-ignore-removal", "不忽略删除的文件（默认行为）"],
      [null, "--ignore-removal", "忽略删除的文件，只添加新增和修改的文件"],
      [null, "--chmod=(+|-)x", "修改文件的可执行权限位"],
      [null, "--pathspec-from-file=<file>", "从文件中读取路径规范"],
      [null, "--pathspec-file-nul", "路径规范文件使用NUL字符分隔"],
      ["-N", "--intent-to-add", "记录文件路径但不添加内容，用于跟踪新文件"],
      [null, "--refresh", "刷新索引中的统计信息"],
      [null, "--ignore-submodules[=<when>]", "忽略子模块的变化"],
      [null, "--renormalize", "强制重新规范化文件的行结束符"],
    ],
    examples: [
      "git add -A",
      "git add -u",
      "git add -p file.js",
      "git add --chmod=+x script.sh",
      "git add -i",
      "git add --dry-run .",
    ],
  },
  {
    name: "restore",
    category: "work",
    description: "恢复工作区或索引中文件到指定提交或 HEAD",
    options: [
      ["-s", "--source=<tree>", "指定恢复的源提交、分支或标签"],
      ["-S", "--staged", "恢复索引中的文件（取消暂存）"],
      ["-W", "--worktree", "恢复工作区中的文件（默认行为）"],
      [null, "--ignore-unmerged", "忽略未合并的条目"],
      [null, "--overlay", "覆盖模式，不删除目标中存在但源中不存在的文件"],
      [null, "--no-overlay", "非覆盖模式，删除目标中存在但源中不存在的文件"],
      ["-p", "--patch", "交互式地选择要恢复的文件块"],
      [null, "--ours", "在合并冲突时选择我们的版本"],
      [null, "--theirs", "在合并冲突时选择他们的版本"],
      ["-m", "--merge", "重新创建冲突的合并状态"],
      [null, "--conflict=<style>", "设置冲突标记的样式（merge、diff3、zdiff3）"],
      [null, "--pathspec-from-file=<file>", "从文件中读取路径规范"],
      [null, "--pathspec-file-nul", "路径规范文件使用NUL字符分隔"],
      ["-q", "--quiet", "静默模式，不显示进度信息"],
      [null, "--progress", "强制显示进度信息"],
      [null, "--no-progress", "不显示进度信息"],
      [null, "--recurse-submodules[=<checkout>]", "递归处理子模块"],
      [null, "--no-recurse-submodules", "不递归处理子模块"],
    ],
    examples: [
      "git restore --staged file.js",
      "git restore -s HEAD~1 app.ts",
      "git restore --source=main file.txt",
      "git restore -p .",
      "git restore --staged --worktree file.js",
      "git restore --ours conflicted-file.txt",
    ],
  },
  {
    name: "rm",
    category: "work",
    description: "从索引与工作区移除文件, 或仅从索引移除",
    options: [
      ["-r", null, "递归目录"],
      ["-f", null, "强制删除"],
      [null, "--cached", "仅从索引移除"],
    ],
    examples: [
      "git rm -r dist/",
      "git rm --cached .env",
    ],
  },
  {
    name: "mv",
    category: "work",
    description: "移动或重命名文件, 等价于文件系统移动后 git add",
    examples: [
      "git mv old.txt new.txt",
    ],
  },
  {
    name: "commit",
    category: "commit",
    description: "创建提交, 支持修订上一提交与 GPG 签名",
    options: [
      ["-m", "--message=<msg>", "指定提交信息，可多次使用创建多段落提交"],
      ["-a", "--all", "自动暂存所有已跟踪文件的修改并提交"],
      ["-p", "--patch", "交互式选择要提交的文件块"],
      ["-C", "--reuse-message=<commit>", "重用指定提交的提交信息和作者信息"],
      ["-c", "--reedit-message=<commit>", "重用指定提交的信息但允许编辑"],
      [null, "--fixup=<commit>", "创建fixup提交，用于后续rebase时自动合并"],
      [null, "--squash=<commit>", "创建squash提交，用于后续rebase时合并"],
      [null, "--reset-author", "重置作者信息为当前用户"],
      [null, "--author=<author>", "覆盖提交的作者信息"],
      [null, "--date=<date>", "覆盖提交的日期"],
      ["-e", "--edit", "强制打开编辑器编辑提交信息"],
      [null, "--no-edit", "不打开编辑器，使用现有或命令行提供的信息"],
      [null, "--amend", "修改最后一次提交，而不是创建新提交"],
      [null, "--no-post-rewrite", "绕过post-rewrite钩子"],
      ["-i", "--include", "提交指定文件，即使它们没有被暂存"],
      ["-o", "--only", "仅提交指定文件，忽略索引中的其他变化"],
      [null, "--pathspec-from-file=<file>", "从文件中读取路径规范"],
      [null, "--pathspec-file-nul", "路径规范文件使用NUL字符分隔"],
      ["-u", "--untracked-files[=<mode>]", "显示未跟踪文件（no|normal|all）"],
      ["-v", "--verbose", "显示将要提交的文件差异"],
      ["-q", "--quiet", "静默模式，减少输出信息"],
      [null, "--dry-run", "预演模式，显示将要提交的内容但不实际提交"],
      [null, "--short", "以简短格式显示状态"],
      [null, "--branch", "显示分支信息"],
      [null, "--porcelain[=<version>]", "以机器可读格式输出"],
      [null, "--long", "以长格式显示状态（默认）"],
      ["-z", "--null", "使用NUL字符分隔文件名"],
      ["-F", "--file=<file>", "从文件中读取提交信息"],
      [null, "--cleanup=<mode>", "设置提交信息清理模式（strip|whitespace|verbatim|scissors|default）"],
      ["-t", "--template=<file>", "使用指定文件作为提交信息模板"],
      ["-s", "--signoff", "在提交信息末尾添加Signed-off-by行"],
      ["-n", "--no-verify", "跳过pre-commit和commit-msg钩子"],
      [null, "--allow-empty", "允许创建空提交"],
      [null, "--allow-empty-message", "允许空的提交信息"],
      [null, "--no-status", "不在提交信息模板中包含git status输出"],
      ["-S", "--gpg-sign[=<keyid>]", "使用GPG签名提交"],
      [null, "--no-gpg-sign", "不使用GPG签名"],
    ],
    examples: [
      "git commit -m \"feat: add login feature\"",
      "git commit -am \"fix: resolve merge conflict\"",
      "git commit --amend --no-edit",
      "git commit --fixup=HEAD~2",
      "git commit -s -m \"docs: update README\"",
      "git commit --author=\"John Doe <john@example.com>\" -m \"fix: bug\"",
    ],
  },
  {
    name: "log",
    category: "history",
    description: "浏览提交历史, 支持图形显示与自定义格式",
    options: [
      [null, "--oneline", "每个提交显示为一行，包含简短哈希和标题"],
      [null, "--graph", "以ASCII字符绘制分支和合并的图形"],
      [null, "--decorate[=<format>]", "显示引用名称（分支、标签等）"],
      [null, "--no-decorate", "不显示引用装饰"],
      ["-p", "--patch", "显示每个提交引入的补丁"],
      ["-u", null, "--patch的别名"],
      [null, "--stat[=<width>[,<name-width>[,<count>]]]", "显示文件变更统计"],
      [null, "--numstat", "以数字形式显示文件变更统计"],
      [null, "--shortstat", "仅显示变更统计的摘要行"],
      [null, "--name-only", "仅显示变更文件的名称"],
      [null, "--name-status", "显示文件名称和变更状态"],
      [null, "--abbrev[=<n>]", "设置哈希值的显示长度"],
      [null, "--no-abbrev", "显示完整的哈希值"],
      [null, "--relative-date", "显示相对日期（如\"2 weeks ago\"）"],
      [null, "--date=<format>", "设置日期格式（relative|local|iso|rfc|short|raw|human|unix）"],
      [null, "--pretty[=<format>]", "使用指定格式显示提交"],
      [null, "--format=<format>", "--pretty=format的别名"],
      [null, "--parents", "显示提交的父提交哈希"],
      [null, "--children", "显示提交的子提交哈希"],
      [null, "--left-right", "显示提交属于哪一侧（用于比较两个分支）"],
      [null, "--cherry-mark", "标记等价的提交"],
      ["-n", "--max-count=<number>", "限制显示的提交数量"],
      [null, "--skip=<number>", "跳过指定数量的提交"],
      [null, "--since=<date>", "显示指定日期之后的提交"],
      [null, "--after=<date>", "--since的别名"],
      [null, "--until=<date>", "显示指定日期之前的提交"],
      [null, "--before=<date>", "--until的别名"],
      [null, "--author=<pattern>", "仅显示作者匹配模式的提交"],
      [null, "--committer=<pattern>", "仅显示提交者匹配模式的提交"],
      [null, "--grep=<pattern>", "仅显示提交信息匹配模式的提交"],
      [null, "--all-match", "所有--grep模式都必须匹配"],
      [null, "--invert-grep", "反转--grep的匹配结果"],
      [null, "--regexp-ignore-case", "忽略正则表达式的大小写"],
      [null, "--basic-regexp", "使用基本正则表达式"],
      [null, "--extended-regexp", "使用扩展正则表达式"],
      [null, "--fixed-strings", "使用固定字符串而非正则表达式"],
      [null, "--perl-regexp", "使用Perl兼容的正则表达式"],
      [null, "--remove-empty", "移除空的合并提交"],
      [null, "--merges", "仅显示合并提交"],
      [null, "--no-merges", "不显示合并提交"],
      [null, "--min-parents=<number>", "仅显示至少有指定数量父提交的提交"],
      [null, "--max-parents=<number>", "仅显示最多有指定数量父提交的提交"],
      [null, "--no-min-parents", "不限制最小父提交数量"],
      [null, "--no-max-parents", "不限制最大父提交数量"],
      [null, "--first-parent", "仅跟随第一个父提交"],
      [null, "--not", "反转后续修订版本的含义"],
      [null, "--all", "显示所有引用的提交"],
      [null, "--branches[=<pattern>]", "显示所有分支的提交"],
      [null, "--tags[=<pattern>]", "显示所有标签的提交"],
      [null, "--remotes[=<pattern>]", "显示所有远程分支的提交"],
      [null, "--glob=<pattern>", "显示匹配模式的引用的提交"],
      [null, "--exclude=<pattern>", "排除匹配模式的引用"],
      [null, "--reflog", "显示所有reflog条目的提交"],
      [null, "--single-worktree", "仅显示当前工作树的引用"],
      [null, "--ignore-missing", "忽略无效的对象名称"],
      [null, "--bisect", "仅显示bisect相关的提交"],
      [null, "--stdin", "从标准输入读取提交"],
      [null, "--cherry-pick", "省略等价的提交"],
      [null, "--walk-reflogs", "遍历reflog而非提交历史"],
      [null, "--merge", "显示合并冲突相关的提交"],
      [null, "--boundary", "显示边界提交"],
      [null, "--simplify-by-decoration", "仅显示被引用装饰的提交"],
      [null, "--full-history", "显示完整历史，不进行简化"],
      [null, "--dense", "仅显示影响指定路径的提交"],
      [null, "--sparse", "显示所有提交，即使不影响指定路径"],
      [null, "--simplify-merges", "简化不必要的合并提交"],
      [null, "--ancestry-path", "仅显示指定提交之间的祖先路径"],
      [null, "--date-order", "按提交日期排序"],
      [null, "--author-date-order", "按作者日期排序"],
      [null, "--topo-order", "按拓扑顺序排序"],
      [null, "--reverse", "反向显示提交"],
      [null, "--no-walk[=<sorted|unsorted>]", "仅显示指定的提交，不遍历历史"],
      [null, "--do-walk", "覆盖之前的--no-walk选项"],
    ],
    examples: [
      "git log --oneline --graph --decorate --all",
      "git log --since=\"2024-01-01\" --author=\"alice\"",
      "git log --grep=\"fix\" --oneline",
      "git log --stat --since=\"1 week ago\"",
      "git log --pretty=format:\"%h %an %ar %s\"",
      "git log --no-merges --first-parent",
    ],
  },
  {
    name: "show",
    category: "history",
    description: "查看对象详情, 常用于查看某次提交内容与差异",
    examples: [
      "git show HEAD~1",
    ],
  },
  {
    name: "diff",
    category: "history",
    description: "比较工作区, 索引与提交之间的差异",
    options: [
      [null, "--cached", "比较索引与 HEAD"],
      [null, "--name-only", "仅显示文件名"],
      [null, "--name-status", "显示文件状态"],
      [null, "--word-diff", "按词高亮差异"],
      [null, "--stat", "显示统计"],
    ],
    examples: [
      "git diff --cached",
      "git diff HEAD~2 HEAD",
    ],
  },
  {
    name: "merge",
    category: "merge",
    description: "把其他分支的更改合入当前分支, 支持快进或创建合并提交",
    options: [
      [null, "--ff", "允许快进合并（默认行为）"],
      [null, "--ff-only", "仅在可以快进时才进行合并，否则失败"],
      [null, "--no-ff", "即使可以快进也创建合并提交"],
      [null, "--commit", "合并后自动创建提交（默认行为）"],
      [null, "--no-commit", "合并后不自动提交，允许检查结果"],
      [null, "--edit", "在创建合并提交前调用编辑器"],
      [null, "--no-edit", "不调用编辑器，使用自动生成的合并信息"],
      [null, "--cleanup=<mode>", "设置合并信息的清理模式"],
      [null, "--log[=<n>]", "在合并信息中包含被合并提交的简短描述"],
      [null, "--no-log", "不在合并信息中包含提交描述"],
      [null, "--signoff", "在合并信息末尾添加Signed-off-by行"],
      [null, "--no-signoff", "不添加Signed-off-by行"],
      [null, "--stat", "合并结束时显示文件变更统计"],
      ["-n", "--no-stat", "不显示文件变更统计"],
      [null, "--squash", "将被合并分支的所有提交压缩为单个提交"],
      [null, "--no-squash", "不压缩提交（默认行为）"],
      ["-s", "--strategy=<strategy>", "使用指定的合并策略"],
      ["-X", "--strategy-option=<option>", "传递选项给合并策略"],
      [null, "--verify-signatures", "验证被合并提交的GPG签名"],
      [null, "--no-verify-signatures", "不验证GPG签名"],
      [null, "--summary", "合并结束时显示摘要（默认行为）"],
      [null, "--no-summary", "不显示摘要"],
      ["-q", "--quiet", "静默模式，减少输出"],
      ["-v", "--verbose", "详细模式，显示更多信息"],
      [null, "--progress", "强制显示进度信息"],
      [null, "--no-progress", "不显示进度信息"],
      [null, "--allow-unrelated-histories", "允许合并不相关的历史"],
      ["-m", "--message=<msg>", "设置合并提交的信息"],
      ["-F", "--file=<file>", "从文件读取合并提交信息"],
      [null, "--rerere-autoupdate", "自动暂存rerere解决的冲突"],
      [null, "--no-rerere-autoupdate", "不自动暂存rerere解决的冲突"],
      [null, "--overwrite-ignore", "覆盖被忽略的文件"],
      [null, "--abort", "中止当前合并过程并恢复到合并前状态"],
      [null, "--quit", "退出当前合并过程但保留索引和工作树"],
      [null, "--continue", "在解决冲突后继续合并过程"],
    ],
    examples: [
      "git merge --no-ff feature/login",
      "git merge --squash feature/cleanup",
      "git merge -X ours conflicting-branch",
      "git merge --strategy=recursive -X patience main",
      "git merge --no-commit --no-ff feature/review",
    ],
  },
  {
    name: "rebase",
    category: "merge",
    description: "把当前分支提交重放到另一个基底上, 支持交互与保留合并",
    options: [
      [null, "--onto <newbase>", "指定新的基底提交"],
      [null, "--keep-base", "保持原始基底不变，仅重新应用提交"],
      [null, "--apply", "使用apply策略进行变基"],
      [null, "--empty=(drop|keep|ask)", "处理空提交的方式"],
      [null, "--keep-empty", "保留空提交"],
      [null, "--no-keep-empty", "丢弃空提交"],
      ["-i", "--interactive", "交互式变基，允许编辑提交列表"],
      ["-r", "--rebase-merges[=no-rebase-cousins|rebase-cousins]", "保留合并提交结构"],
      ["-p", "--preserve-merges", "已废弃，使用--rebase-merges"],
      ["-x", "--exec <command>", "在每个提交后执行指定命令"],
      [null, "--root", "变基到根提交"],
      [null, "--autosquash", "自动重排fixup!和squash!提交"],
      [null, "--no-autosquash", "不自动重排特殊提交"],
      [null, "--autostash", "变基前自动暂存工作区更改"],
      [null, "--no-autostash", "不自动暂存"],
      [null, "--no-ff", "即使可以快进也使用变基"],
      ["-f", "--force-rebase", "强制变基，即使分支是最新的"],
      [null, "--no-fork-point", "不使用fork-point模式"],
      [null, "--ignore-whitespace", "忽略空白字符差异"],
      [null, "--whitespace=<option>", "空白字符处理方式"],
      [null, "--committer-date-is-author-date", "使用作者日期作为提交者日期"],
      [null, "--ignore-date", "忽略作者日期，使用当前时间"],
      [null, "--reset-author-date", "重置作者日期为当前时间"],
      ["-C<n>", null, "传递-C<n>选项给git apply"],
      [null, "--strategy=<strategy>", "使用指定的合并策略"],
      ["-X", "--strategy-option=<option>", "传递选项给合并策略"],
      [null, "--gpg-sign[=<keyid>]", "使用GPG签名提交"],
      [null, "--no-gpg-sign", "不使用GPG签名"],
      ["-q", "--quiet", "静默模式"],
      ["-v", "--verbose", "详细模式"],
      [null, "--stat", "显示变基统计"],
      ["-n", "--no-stat", "不显示统计"],
      [null, "--no-verify", "跳过pre-rebase钩子"],
      [null, "--verify", "运行pre-rebase钩子"],
      ["-C", "--allow-empty-message", "允许空的提交信息"],
      [null, "--reschedule-failed-exec", "重新安排失败的exec命令"],
      [null, "--reapply-cherry-picks", "重新应用cherry-pick提交"],
      [null, "--no-reapply-cherry-picks", "不重新应用cherry-pick提交"],
      [null, "--continue", "解决冲突后继续变基"],
      [null, "--skip", "跳过当前提交继续变基"],
      [null, "--abort", "中止变基并恢复到原始状态"],
      [null, "--quit", "退出变基但保留HEAD在当前位置"],
      [null, "--edit-todo", "编辑待办事项列表"],
      [null, "--show-current-patch", "显示当前正在应用的补丁"],
    ],
    examples: [
      "git rebase -i HEAD~5 --autosquash",
      "git rebase --onto main feature-base feature-x",
      "git rebase -i --root",
      "git rebase --rebase-merges main",
      "git rebase -x 'make test' main",
    ],
  },
  {
    name: "fetch",
    category: "remote",
    description: "从远程获取引用与对象, 可清理失效远程分支",
    options: [
      [null, "--all", "从所有配置的远程仓库获取"],
      ["-a", "--append", "将获取的引用追加到现有内容而不是覆盖"],
      [null, "--atomic", "使用原子事务更新本地引用"],
      [null, "--depth=<depth>", "限制获取的历史深度"],
      [null, "--deepen=<depth>", "加深浅仓库的历史"],
      [null, "--shallow-since=<date>", "加深浅仓库到指定日期"],
      [null, "--shallow-exclude=<revision>", "加深浅仓库但排除指定修订版本"],
      [null, "--unshallow", "将浅仓库转换为完整仓库"],
      [null, "--update-shallow", "接受需要更新浅文件的引用"],
      [null, "--negotiation-tip=<commit>", "报告指定提交的可达性以优化协商"],
      [null, "--negotiate-only", "不获取对象，仅进行协商"],
      [null, "--dry-run", "显示将要执行的操作但不实际执行"],
      [null, "--write-fetch-head", "将远程引用写入FETCH_HEAD（默认）"],
      [null, "--no-write-fetch-head", "不写入FETCH_HEAD"],
      ["-f", "--force", "强制更新本地引用"],
      ["-k", "--keep", "保留下载的包"],
      [null, "--multiple", "允许指定多个远程仓库"],
      [null, "--auto-maintenance", "在获取后运行自动维护"],
      [null, "--no-auto-maintenance", "不运行自动维护"],
      [null, "--auto-gc", "在获取后运行自动垃圾回收"],
      [null, "--no-auto-gc", "不运行自动垃圾回收"],
      [null, "--write-commit-graph", "获取后写入提交图"],
      [null, "--no-write-commit-graph", "不写入提交图"],
      ["-p", "--prune", "删除远程已不存在的本地远程跟踪分支"],
      ["-P", "--prune-tags", "删除远程已不存在的本地标签"],
      ["-n", "--no-tags", "不获取标签"],
      [null, "--refmap=<refspec>", "指定引用映射"],
      ["-t", "--tags", "获取所有标签"],
      [null, "--recurse-submodules[=yes|on-demand|no]", "控制子模块的递归获取"],
      ["-j", "--jobs=<n>", "并行获取子模块的数量"],
      [null, "--no-recurse-submodules", "不递归获取子模块"],
      [null, "--set-upstream", "设置上游引用"],
      [null, "--submodule-prefix=<path>", "为子模块递归调用添加路径前缀"],
      [null, "--recurse-submodules-default=[yes|on-demand]", "设置子模块递归的默认模式"],
      ["-u", "--update-head-ok", "允许更新当前分支的头"],
      [null, "--upload-pack=<path>", "指定远程git-upload-pack的路径"],
      ["-q", "--quiet", "静默模式，减少输出"],
      ["-v", "--verbose", "详细模式，显示更多信息"],
      [null, "--progress", "强制显示进度"],
      [null, "--no-progress", "不显示进度"],
      ["-o", "--server-option=<option>", "传递选项给服务器"],
      [null, "--show-forced-updates", "检查强制更新的分支"],
      [null, "--no-show-forced-updates", "不检查强制更新"],
      ["-4", "--ipv4", "仅使用IPv4地址"],
      ["-6", "--ipv6", "仅使用IPv6地址"],
    ],
    examples: [
      "git fetch -p origin",
      "git fetch --all --tags",
      "git fetch --depth=1 origin main",
      "git fetch --recurse-submodules=on-demand",
      "git fetch --dry-run origin",
    ],
  },
  {
    name: "pull",
    category: "remote",
    description: "获取远程更改并合并或变基到本地分支",
    options: [
      ["-q", "--quiet", "静默模式，减少输出"],
      ["-v", "--verbose", "详细模式，显示更多信息"],
      [null, "--progress", "强制显示进度"],
      [null, "--no-progress", "不显示进度"],
      [null, "--recurse-submodules[=yes|on-demand|no]", "控制子模块的递归"],
      [null, "--no-recurse-submodules", "不递归处理子模块"],
      [null, "--commit", "合并后自动提交（默认）"],
      [null, "--no-commit", "合并后不自动提交"],
      [null, "--edit", "合并前调用编辑器编辑合并信息"],
      [null, "--no-edit", "不调用编辑器"],
      [null, "--cleanup=<mode>", "设置合并信息的清理模式"],
      [null, "--ff", "允许快进合并（默认）"],
      [null, "--ff-only", "仅在可以快进时才合并"],
      [null, "--no-ff", "即使可以快进也创建合并提交"],
      ["-S", "--gpg-sign[=<keyid>]", "使用GPG签名合并提交"],
      [null, "--no-gpg-sign", "不使用GPG签名"],
      [null, "--log[=<n>]", "在合并信息中包含提交摘要"],
      [null, "--no-log", "不包含提交摘要"],
      [null, "--signoff", "添加Signed-off-by行"],
      [null, "--no-signoff", "不添加Signed-off-by行"],
      [null, "--stat", "显示合并统计"],
      ["-n", "--no-stat", "不显示合并统计"],
      [null, "--squash", "压缩合并"],
      [null, "--no-squash", "不压缩合并"],
      ["-s", "--strategy=<strategy>", "使用指定合并策略"],
      ["-X", "--strategy-option=<option>", "传递选项给合并策略"],
      [null, "--verify-signatures", "验证GPG签名"],
      [null, "--no-verify-signatures", "不验证GPG签名"],
      [null, "--summary", "显示合并摘要"],
      [null, "--no-summary", "不显示合并摘要"],
      [null, "--allow-unrelated-histories", "允许合并不相关历史"],
      ["-r", "--rebase[=false|true|merges|interactive]", "使用变基而不是合并"],
      [null, "--no-rebase", "不使用变基"],
      [null, "--autostash", "变基前自动暂存本地修改"],
      [null, "--no-autostash", "不自动暂存"],
      [null, "--all", "获取所有远程"],
      ["-a", "--append", "追加获取的引用"],
      [null, "--atomic", "使用原子事务"],
      [null, "--depth=<depth>", "限制获取深度"],
      [null, "--deepen=<depth>", "加深浅仓库"],
      [null, "--shallow-since=<date>", "浅化到指定日期"],
      [null, "--shallow-exclude=<revision>", "浅化时排除修订版本"],
      [null, "--unshallow", "转换为完整仓库"],
      [null, "--update-shallow", "更新浅文件"],
      [null, "--dry-run", "预演模式"],
      ["-f", "--force", "强制更新引用"],
      ["-k", "--keep", "保留下载的包"],
      [null, "--multiple", "允许多个远程"],
      ["-p", "--prune", "删除失效的远程跟踪分支"],
      ["-P", "--prune-tags", "删除失效的标签"],
      [null, "--no-tags", "不获取标签"],
      ["-t", "--tags", "获取标签"],
      [null, "--refmap=<refspec>", "指定引用映射"],
      ["-j", "--jobs=<n>", "并行作业数"],
      [null, "--set-upstream", "设置上游"],
      [null, "--upload-pack=<path>", "指定upload-pack路径"],
      [null, "--show-forced-updates", "显示强制更新"],
      [null, "--no-show-forced-updates", "不显示强制更新"],
      ["-4", "--ipv4", "仅使用IPv4"],
      ["-6", "--ipv6", "仅使用IPv6"],
    ],
    examples: [
      "git pull --rebase origin main",
      "git pull --ff-only",
      "git pull --no-commit origin feature",
      "git pull --recurse-submodules",
    ],
  },
  {
    name: "push",
    category: "remote",
    description: "把本地引用推送到远程, 支持设置上游与强制推送",
    options: [
      [null, "--all", "推送所有分支"],
      [null, "--prune", "删除远程不存在的本地引用"],
      [null, "--mirror", "镜像推送所有引用"],
      [null, "--delete", "删除指定的引用"],
      [null, "--tags", "推送所有标签"],
      [null, "--follow-tags", "推送注释标签"],
      [null, "--signed[=yes|no|if-asked]", "使用GPG签名推送"],
      [null, "--no-signed", "不使用GPG签名"],
      [null, "--atomic", "使用原子事务推送"],
      [null, "--no-atomic", "不使用原子事务"],
      ["-o", "--push-option=<option>", "传递选项给服务器"],
      [null, "--receive-pack=<path>", "指定远程receive-pack路径"],
      [null, "--exec=<path>", "--receive-pack的别名"],
      ["-f", "--force", "强制推送，覆盖远程更改"],
      [null, "--force-with-lease[=<refname>[:<expect>]]", "更安全的强制推送"],
      [null, "--force-if-includes", "仅在包含远程提示时强制推送"],
      [null, "--no-force-if-includes", "不检查远程提示"],
      [null, "--repo=<repository>", "指定仓库"],
      ["-u", "--set-upstream", "设置上游跟踪关系"],
      [null, "--thin", "使用精简传输"],
      [null, "--no-thin", "不使用精简传输"],
      ["-q", "--quiet", "静默模式"],
      ["-v", "--verbose", "详细模式"],
      [null, "--progress", "强制显示进度"],
      [null, "--no-progress", "不显示进度"],
      [null, "--no-recurse-submodules", "不递归推送子模块"],
      [null, "--recurse-submodules=check", "检查子模块提交是否已推送"],
      [null, "--recurse-submodules=on-demand", "按需推送子模块"],
      [null, "--recurse-submodules=only", "仅推送子模块"],
      [null, "--recurse-submodules=no", "不推送子模块"],
      [null, "--verify", "运行pre-push钩子"],
      [null, "--no-verify", "跳过pre-push钩子"],
      ["-4", "--ipv4", "仅使用IPv4"],
      ["-6", "--ipv6", "仅使用IPv6"],
      [null, "--dry-run", "预演模式，不实际推送"],
      [null, "--porcelain", "机器可读输出"],
    ],
    examples: [
      "git push -u origin main",
      "git push --force-with-lease origin feature",
      "git push origin --delete old-branch",
      "git push --tags origin",
      "git push --all origin",
      "git push --dry-run origin main",
    ],
  },
  {
    name: "tag",
    category: "branch",
    description: "创建, 列表, 删除与推送标签, 支持附注与签名",
    options: [
      ["-a", "--annotate", "创建带注释的标签对象"],
      ["-s", "--sign", "使用默认GPG密钥创建签名标签"],
      ["-u", "--local-user=<keyid>", "使用指定GPG密钥创建签名标签"],
      ["-f", "--force", "强制创建标签，覆盖已存在的标签"],
      ["-d", "--delete", "删除指定的标签"],
      ["-v", "--verify", "验证标签的GPG签名"],
      ["-n<num>", null, "指定-l选项显示的行数"],
      ["-l", "--list", "列出匹配模式的标签"],
      [null, "--sort=<key>", "按指定键排序标签列表"],
      [null, "--color[=<when>]", "控制颜色输出"],
      [null, "--no-color", "禁用颜色输出"],
      [null, "--column[=<options>]", "以列格式显示标签"],
      [null, "--no-column", "不使用列格式"],
      [null, "--contains [<commit>]", "仅列出包含指定提交的标签"],
      [null, "--no-contains [<commit>]", "仅列出不包含指定提交的标签"],
      [null, "--merged [<commit>]", "仅列出已合并到指定提交的标签"],
      [null, "--no-merged [<commit>]", "仅列出未合并到指定提交的标签"],
      [null, "--points-at <object>", "仅列出指向指定对象的标签"],
      ["-m", "--message=<msg>", "设置标签信息"],
      ["-F", "--file=<file>", "从文件读取标签信息"],
      [null, "--edit", "强制编辑标签信息"],
      [null, "--cleanup=<mode>", "设置标签信息的清理模式"],
      [null, "--create-reflog", "为标签创建reflog"],
      [null, "--format=<format>", "使用自定义格式显示标签"],
    ],
    examples: [
      "git tag -a v1.0.0 -m \"Release version 1.0.0\"",
      "git tag -s v1.0.0 -m \"Signed release\"",
      "git tag -l 'v1.*'",
      "git tag --sort=-version:refname",
      "git tag -d old-tag",
      "git tag --contains HEAD~5",
    ],
  },
  {
    name: "stash",
    category: "work",
    description: "暂存现场, 支持包含未跟踪与忽略文件并按需恢复",
    subcommands: [
      { name: "list [<log-options>]", description: "列出所有暂存条目，可使用log选项格式化输出" },
      { name: "show [-u|--include-untracked] [-p|--patch] [<diff-options>] [<stash>]", description: "显示暂存条目的更改，默认显示最新的" },
      { name: "drop [-q|--quiet] [<stash>]", description: "删除指定的暂存条目" },
      { name: "pop [--index] [-q|--quiet] [<stash>]", description: "应用暂存条目并从暂存列表中删除" },
      { name: "apply [--index] [-q|--quiet] [<stash>]", description: "应用暂存条目但保留在暂存列表中" },
      { name: "branch <branchname> [<stash>]", description: "创建新分支并应用暂存条目" },
      { name: "push [-p|--patch] [-S|--staged] [-k|--keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [-m|--message <message>] [--pathspec-from-file=<file>] [--] [<pathspec>...]", description: "创建新的暂存条目" },
      { name: "clear", description: "删除所有暂存条目" },
      { name: "create [<message>]", description: "创建暂存条目但不保存到暂存列表" },
      { name: "store [-m|--message <message>] [-q|--quiet] <commit>", description: "将给定的提交存储为暂存条目" },
    ],
    options: [
      ["-a", "--all", "暂存所有文件，包括被忽略的文件"],
      ["-u", "--include-untracked", "暂存未跟踪的文件"],
      ["-S", "--staged", "仅暂存已暂存的更改"],
      ["-k", "--keep-index", "保持索引不变"],
      [null, "--no-keep-index", "不保持索引（默认行为）"],
      ["-p", "--patch", "交互式选择要暂存的更改块"],
      ["-q", "--quiet", "静默模式，减少输出"],
      ["-m", "--message=<message>", "为暂存条目添加描述信息"],
      [null, "--pathspec-from-file=<file>", "从文件读取路径规范"],
      [null, "--pathspec-file-nul", "路径规范文件使用NUL分隔"],
      [null, "--index", "尝试恢复索引状态"],
    ],
    examples: [
      "git stash push -u -m \"WIP: working on login feature\"",
      "git stash list --oneline",
      "git stash show -p stash@{1}",
      "git stash pop --index",
      "git stash apply stash@{2}",
      "git stash branch feature-branch stash@{0}",
      "git stash push --patch",
      "git stash push --staged -m \"staged changes only\"",
    ],
  },
  {
    name: "cherry-pick",
    category: "merge",
    description: "把某次提交引入当前分支, 支持不提交与附加来源信息",
    options: [
      ["-n", "--no-commit", "仅应用变化不提交"],
      ["-x", null, "在说明尾部附加来源哈希"],
      ["-e", "--edit", "编辑提交说明"],
      [null, "--continue", "继续流程"],
      [null, "--abort", "中止"],
      [null, "--quit", "退出流程但保留状态"],
    ],
    examples: [
      "git cherry-pick -n <hash>",
    ],
  },
  {
    name: "revert",
    category: "merge",
    description: "生成反向提交以回滚某次更改, 支持回滚合并提交",
    options: [
      ["-n", "--no-commit", "仅应用变化不提交"],
      ["-m <parent>", null, "回滚合并提交指定父编号"],
      [null, "--continue", "继续"],
      [null, "--abort", "中止"],
      [null, "--quit", "退出流程"],
    ],
    examples: [
      "git revert -m 1 <merge-commit>",
    ],
  },
  {
    name: "reset",
    category: "commit",
    description: "移动 HEAD 并选择性重置索引与工作区",
    options: [
      [null, "--soft", "仅移动HEAD指针，保持索引和工作区不变"],
      [null, "--mixed", "移动HEAD并重置索引，但保持工作区不变（默认）"],
      [null, "--hard", "移动HEAD，重置索引和工作区，丢弃所有更改"],
      [null, "--merge", "移动HEAD并重置索引，保留工作区中未冲突的更改"],
      [null, "--keep", "移动HEAD并重置索引，但保留工作区中的本地更改"],
      ["-q", "--quiet", "静默模式，减少输出信息"],
      [null, "--refresh", "刷新索引后退出，不移动HEAD"],
      [null, "--no-refresh", "不刷新索引"],
      [null, "--pathspec-from-file=<file>", "从文件读取路径规范"],
      [null, "--pathspec-file-nul", "路径规范文件使用NUL分隔"],
      ["-p", "--patch", "交互式选择要重置的更改块"],
      [null, "--intent-to-add", "将重置的路径标记为intent-to-add"],
      [null, "--no-intent-to-add", "不标记为intent-to-add"],
    ],
    examples: [
      "git reset --hard HEAD~1",
      "git reset --soft HEAD~3",
      "git reset --mixed HEAD~2",
      "git reset HEAD file.txt",
      "git reset --patch",
    ],
  },
  {
    name: "bisect",
    category: "history",
    description: "二分查找引入错误的提交, 通过标记 good 与 bad 缩小范围",
    subcommands: [
      { name: "start", description: "开始流程" },
      { name: "good", description: "标记一个已知良好提交" },
      { name: "bad", description: "标记一个已知有问题提交" },
      { name: "reset", description: "结束并回到起点" },
    ],
    examples: [
      "git bisect start; git bisect bad; git bisect good v1.0",
    ],
  },
  {
    name: "worktree",
    category: "work",
    description: "在同一仓库下管理多个工作目录, 支持锁定与清理",
    subcommands: [
      { name: "add [-f] [--detach] [--checkout] [--lock] [-b <new-branch>] <path> [<commit-ish>]", description: "在指定路径创建新的工作树" },
      { name: "list [--porcelain]", description: "列出所有工作树的详细信息" },
      { name: "lock [--reason <string>] <worktree>", description: "锁定工作树以防止自动清理" },
      { name: "move <worktree> <new-path>", description: "移动工作树到新位置" },
      { name: "prune [-n] [-v] [--expire <expire>]", description: "清理工作树信息" },
      { name: "remove [-f] <worktree>", description: "删除工作树" },
      { name: "repair [<path>...]", description: "修复工作树管理文件" },
      { name: "unlock <worktree>", description: "解锁工作树" },
    ],
    options: [
      ["-f", "--force", "强制执行操作，覆盖安全检查"],
      ["-b", "--new-branch <branch>", "创建新分支并检出到工作树"],
      ["-B", null, "创建或重置分支并检出到工作树"],
      [null, "--detach", "在分离HEAD状态下创建工作树"],
      [null, "--checkout", "检出<commit-ish>到新工作树（默认）"],
      [null, "--no-checkout", "不检出文件到新工作树"],
      [null, "--guess-remote", "如果<branch>不存在，尝试创建跟踪远程分支"],
      [null, "--no-guess-remote", "不尝试猜测远程分支"],
      [null, "--track", "设置新分支跟踪远程分支"],
      [null, "--no-track", "不设置分支跟踪"],
      [null, "--lock", "创建后立即锁定工作树"],
      ["-q", "--quiet", "静默模式"],
      [null, "--porcelain", "以机器可读格式输出"],
      [null, "--reason <string>", "锁定工作树的原因"],
      ["-n", "--dry-run", "预演模式，不实际执行清理"],
      ["-v", "--verbose", "详细输出清理信息"],
      [null, "--expire <time>", "清理指定时间之前的工作树"],
    ],
    examples: [
      "git worktree add -b hotfix ../hotfix-branch",
      "git worktree add --detach ../temp-work HEAD~1",
      "git worktree list --porcelain",
      "git worktree remove ../old-feature",
      "git worktree lock --reason 'in use' ../important-work",
    ],
  },
  {
    name: "submodule",
    category: "extra",
    description: "管理子模块, 支持初始化, 同步与切换分支",
    subcommands: [
      { name: "add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--depth <depth>] [--] <repository> [<path>]", description: "添加子模块到仓库" },
      { name: "status [--cached] [--recursive] [--] [<path>...]", description: "显示子模块状态" },
      { name: "init [--] [<path>...]", description: "初始化子模块配置" },
      { name: "deinit [-f|--force] (--all| [--] <path>...)", description: "取消初始化子模块" },
      { name: "update [--init] [--remote] [-N|--no-fetch] [--[no-]recommend-shallow] [-f|--force] [--checkout|--rebase|--merge] [--reference <repository>] [--depth <depth>] [--recursive] [--jobs <n>] [--] [<path>...]", description: "更新子模块" },
      { name: "set-branch (--default|--branch <branch>) [--] <path>", description: "设置子模块的默认远程跟踪分支" },
      { name: "set-url [--] <path> <newurl>", description: "设置子模块的URL" },
      { name: "summary [--cached|--files] [(-n|--summary-limit) <n>] [commit] [--] [<path>...]", description: "显示子模块更改摘要" },
      { name: "foreach [--recursive] <command>", description: "在每个子模块中执行命令" },
      { name: "sync [--recursive] [--] [<path>...]", description: "同步子模块的远程URL配置" },
      { name: "absorbgitdirs [<path>...]", description: "将子模块的git目录移动到超级项目的.git/modules路径" },
    ],
    options: [
      ["-q", "--quiet", "静默模式，减少输出"],
      [null, "--all", "对所有子模块执行操作"],
      ["-b", "--branch <branch>", "指定子模块跟踪的远程分支"],
      ["-f", "--force", "强制执行操作"],
      [null, "--cached", "使用索引中的信息而不是工作树"],
      [null, "--files", "比较索引和工作树中的子模块提交"],
      [null, "--summary-limit <n>", "限制摘要输出的行数"],
      ["-N", "--no-fetch", "不从远程获取子模块"],
      [null, "--checkout", "检出超级项目中记录的提交（默认）"],
      [null, "--merge", "将超级项目中记录的提交合并到子模块的当前分支"],
      [null, "--rebase", "将子模块的当前分支变基到超级项目中记录的提交"],
      [null, "--init", "初始化所有尚未初始化的子模块"],
      [null, "--name <name>", "指定子模块的名称"],
      [null, "--reference <repository>", "指定参考仓库以节省克隆时间"],
      [null, "--dissociate", "从参考仓库断开连接"],
      [null, "--depth <depth>", "创建浅克隆"],
      [null, "--progress", "显示进度信息"],
      [null, "--remote", "使用子模块远程跟踪分支的状态"],
      [null, "--no-recommend-shallow", "忽略浅克隆建议"],
      [null, "--recommend-shallow", "推荐浅克隆"],
      [null, "--recursive", "递归处理嵌套子模块"],
      ["-j", "--jobs <n>", "并行克隆的子模块数量"],
      [null, "--single-branch", "仅克隆单个分支"],
      [null, "--no-single-branch", "克隆所有分支"],
    ],
    examples: [
      "git submodule add https://github.com/user/repo.git libs/repo",
      "git submodule init",
      "git submodule update --init --recursive",
      "git submodule update --remote",
      "git submodule foreach 'git pull origin main'",
      "git submodule sync --recursive",
    ],
  },
  {
    name: "subtree",
    category: "extra",
    description: "以子目录方式引入外部仓库内容的扩展命令",
    subcommands: [
      { name: "add --prefix=<dir> <repo> <branch>", description: "添加子树" },
      { name: "pull --prefix=<dir> <repo> <branch>", description: "拉取更新" },
      { name: "split --prefix=<dir> [-b <name>] [--rejoin]", description: "拆分生成分支" },
    ],
  },
  {
    name: "clean",
    category: "work",
    description: "清理未跟踪与忽略文件, 支持预演模式",
    options: [
      ["-d", null, "递归删除未跟踪的目录"],
      ["-f", "--force", "强制删除文件，绕过安全检查"],
      ["-i", "--interactive", "交互式删除，逐个确认"],
      ["-n", "--dry-run", "预演模式，显示将要删除的文件但不实际删除"],
      ["-q", "--quiet", "静默模式，不显示删除的文件名"],
      ["-e", "--exclude=<pattern>", "排除匹配模式的文件"],
      ["-x", null, "删除被.gitignore忽略的文件"],
      ["-X", null, "仅删除被.gitignore忽略的文件，保留未跟踪的文件"],
    ],
    examples: [
      "git clean -ndx",
      "git clean -fdx",
      "git clean -i",
      "git clean -f -e '*.log'",
      "git clean -fX",
    ],
  },
  {
    name: "grep",
    category: "history",
    description: "在工作区或历史中搜索内容",
    options: [
      ["-n", null, "显示行号"],
      ["-i", null, "忽略大小写"],
      ["-I", null, "忽略二进制文件"],
      ["-e <pat>", null, "指定模式"],
    ],
    examples: [
      "git grep -n TODO HEAD -- ':!dist'",
    ],
  },
  {
    name: "reflog",
    category: "extra",
    description: "查看引用移动历史, 常与 reset 一起用于回溯",
    examples: [
      "git reflog",
    ],
  },
];
